package com.atguigu.ssyx.common.auth;

import com.atguigu.ssyx.vo.user.UserLoginVo;
import lombok.Data;

@Data

public class AuthContextHolder {

    private static ThreadLocal<Long> userId = new ThreadLocal<>();

    private static ThreadLocal<Long> wareId = new ThreadLocal<>();

    private static ThreadLocal<UserLoginVo> userLoginVo = new ThreadLocal<>();

    public static void setUserId(Long id) {
        userId.set(id);
    }

    public static Long getUserId() {
        return userId.get();
    }

    public static void setWareId(Long id) {
        wareId.set(id);
    }

    public static Long getWareId() {
        return wareId.get();
    }

    public static void setUserLoginVo(UserLoginVo userLoginVo) {
        AuthContextHolder.userLoginVo.set(userLoginVo);
    }

    public static UserLoginVo getUserLoginVo() {
        return userLoginVo.get();
    }
}
